<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>06-过滤器.html</title>
    <script src="../js/vue.js"></script>
    <script>

    </script>
</head>
<body>
<!--1. 准备一个容器-->
<div id="app">
    <p>性别:{{sex|sexFilter}}</p>
</div>
<!--全局过滤器-->
<div id="app1">
    <p>性别:{{sex|sexFilter1}}</p>
</div>
<script>
    let vm = new Vue({
        el: "#app",
        data: {
            sex:1,
        },
        methods : {

        },
        filters:{
            sexFilter:function (sex) {
                return sex == 1? "男":"女";
            }
        }
    });

    Vue.filter("sexFilter1",function (sex) {
        return sex==1?"男":"女";
    })
</script>


</body>
</html>